<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );

class HTML_media_db{

	function header_view(){
echo '<h1 align="center" class="mdb_outlinebox">Gesamtliste</h1>';
	}

	function display( &$rows,$pageNav, $limitstart, $limit, $total, $totalRows,$gb_params, $kats ) {

	global $mdb_acclevel;

		global $mosConfig_live_site, $option, $Itemid;
		$c = count ($rows);
		HTML_media_db::header_view();

		$link = $mosConfig_live_site ."/index.php?option=$option&Itemid=$Itemid";
	?>
	<table width="100%" class="medialist">
		<tr class="sectiontableheader">
			<td><?php echo $pageNav->writePagesCounter(); ?></td>
			<td>
					<?php 
						$link = $mosConfig_live_site ."/index.php?option=$option&amp;Itemid=$Itemid";
						echo "Es werden ".$pageNav->getLimitBox( $link )." Datens&auml;tze angezeigt.";
					?>
			</td>
			</tr>
			<tr class="sectiontableheader">
			<td colspan="2"><?php echo $pageNav->writePagesLinks( $link ); ?></td>
		</tr>
		</table>
		
		<table width="100%" class="medialist">
		  <tr>
		  		<th>&nbsp;</th><th>&nbsp;</th>
							<th>ID</th>
							<?php // if ($gb_params->get( 'pv_how', 1)) { ?>
							<th>Media</th>
							 <?php // }?>
						    <th>Gruppe</th>
						    <th>Titel</th>
						    <th>Jahr</th>														 
							
	  </tr>
			<?php
			
				$z		= $limitstart + 1;
				$end 	= $limit + $z;
				if ( $end > $total ) {
					$end = $total + 1;
				}
				
				$k = 0;
        		$tabclass = array("sectiontableentry1", "sectiontableentry2");
				for( $i=$z; $i < $end; $i++ ) {
					//mosMakeHtmlSafe($row);
					$row = $rows[$i-1];
					mosMakeHtmlSafe($row);
					 $k = $k ? 0 : 1 ;
					?>
					
				 <tr align="left" valign="top"  class="<?php echo 'row'.$k; ?>">

			<td>
			<?php 
			if ( $mdb_acclevel == 4 ) echo "#".$row->id;

			if ( $mdb_acclevel >= 3 ) {
         	echo '<a href="'.$mosConfig_live_site.'/index.php?option=com_media_db&akto=media_edit&edid='.$row->id.'" alt="Bearbeiten" title="Bearbeiten">
				<img src="'.$mosConfig_live_site.'/includes/js/ThemeOffice/edit_1.png" border="0" alt="Bearbeiten"/>
				</a>';
         }
			else echo '&nbsp;';
			?>

			
         </td>
			<td><?php mdbComposeTooltip ($row, $kats); ?></td>


				   <td><?php echo $row->unique_id;?></td>
							<?php  if (1==1){//($gb_params->get( 'pv_how', 1)) { ?>
							<td><?php echo $kats[$row->id_kat-1]->name;?></td>
							<td><?php echo mdb_format_cut($row->gruppe, 40);?></td>
							 <?php }?>
						    <td><?php echo mdb_format_cut($row->titel, 40);?></td>
						    <td><?php echo $row->jahr;?></td>
  		</tr>
		<?php }	?>
	</table>
	
	<?	

		}
		
			function conclusion( $totalRows, $pageNav ) {
		global $mosConfig_live_site, $option, $Itemid;
		?>

				<div align="center">
					<?php
				$link = $mosConfig_live_site ."/index.php?option=$option&Itemid=$Itemid";
				echo $pageNav->writePagesCounter();
				echo "<BR \>";

				echo $pageNav->writePagesLinks( $link );
					?>
				</div>

		<?php
	}
}
?>